import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import refresh from '@dfeidao/atom-web/url/refresh';
import success from '@dfeidao/atom-web/msgbox/success';
import error from '@dfeidao/atom-web/msgbox/error';

export default async function a003(fd: IFeidaoAiBrowserComponent) {
	// 这里是修改的保存
	const staff_no = get(fd,'staff_no');
	const cabinet_staff_no=fd.data.node.querySelector<HTMLInputElement>('[data-id="cabinet_staff_no"]').value;
	const staff_name=fd.data.node.querySelector<HTMLInputElement>('[data-id="staff_name"]').value;
	const contact_number=fd.data.node.querySelector<HTMLInputElement>('[data-id="contact_number"]').value;
	if (cabinet_staff_no === "" || staff_name === "" || contact_number === "") {
		error("必填项不能为空哦！");
return;
	}
	const staff_nation=fd.data.node.querySelector<HTMLInputElement>('[data-id="staff_nation"]').value;
	const se=fd.data.node.querySelector<HTMLSelectElement>('[data-id="sex"]');
	const sex=se.value === "请选择" ? '' :se.value;
	const state=fd.data.node.querySelector<HTMLSelectElement>('[data-id="staff_state"]');
	const staff_state=state.value === "请选择" ? '' :state.value;
	const edu=fd.data.node.querySelector<HTMLSelectElement>('[data-id="education"]');
	const education=edu.value === "请选择" ? '' :edu.value;
	const marital=fd.data.node.querySelector<HTMLSelectElement>('[data-id="marital_status"]');
	const marital_status=marital.value === "请选择" ? '' :marital.value;
	const native_place=fd.data.node.querySelector<HTMLInputElement>('[data-id="native_place"]').value;
	const politics=fd.data.node.querySelector<HTMLSelectElement>('[data-id="politics_face"]');
	const politics_face=politics.value === "请选择" ? '' :politics.value;
	const family_address=fd.data.node.querySelector<HTMLInputElement>('[data-id="family_address"]').value;
	const res = await nodejs<{code: 0|1;result: string;}>('staff-management/zj-000003/s003',{
		filter:{
			staff_no ,
cabinet_staff_no,
staff_name,
contact_number,
staff_nation,
sex,
staff_state,
education,
marital_status,
native_place,
politics_face,
family_address
		}
	});
	if (res.code === 1) {
		success("修改成功");
		refresh();
	}
	if (res.code === 0) {
		error("修改失败");
	}
}
